package com.dp.searchbuilder.action;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.dp.searchbuilder.bean.BuildEvent;
import com.dp.searchbuilder.dao.BuilderDao;
import com.dp.searchbuilder.service.ActionService;
import com.dp.searchbuilder.service.impl.ActionServiceImpl;

public class DisplayAction extends BaseAction{

	private String gitServer;
	
	private String branchName;
	
	private List<BuildEvent> eventList = new ArrayList<BuildEvent>();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private ActionServiceImpl actionService;
	
	public String display()
	{
		if(actionService==null)
		{
			ApplicationContext act = new ClassPathXmlApplicationContext("applicationContext.xml");
			actionService = (ActionServiceImpl) act.getBean("actionService");
		}
		eventList = actionService.getCertainEvent(gitServer, branchName);
		if(eventList==null)
		{
			return "fail";
		}
		else
		{
			return "success";
		}
	}
	

	public String getGitServer() {
		return gitServer;
	}


	public void setGitServer(String gitServer) {
		this.gitServer = gitServer;
	}


	public String getBranchName() {
		return branchName;
	}


	public void setBranchName(String branchName) {
		this.branchName = branchName;
	}


	public ActionServiceImpl getActionService() {
		return actionService;
	}


	public void setActionService(ActionServiceImpl actionService) {
		this.actionService = actionService;
	}

	
}
